<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="file/who.xml">d</a>
<div>
    <p id="name"></p>
    <p id="sex"></p>
    <p id="lesson"></p>
    <p id="job"></p>
    <p id="work"></p>
</div>
</body>
<script>
    window.onload = function () {
        document.getElementsByTagName('a')[0].onclick = function () {
            let request = new XMLHttpRequest();
            request.open('GET',this.href+'?='+(new Date()),true);
            request.send();

            request.onreadystatechange = function () {
                let result = request.responseXML;
                let name = result.getElementsByTagName('name')[0].childNodes[0].nodeValue;
                let sex = result.getElementsByTagName('sex')[0].childNodes[0].nodeValue;
                let lesson = result.getElementsByTagName('lesson')[0].childNodes[0].nodeValue;
                let job = result.getElementsByTagName('job')[0].childNodes[0].nodeValue;
                let work = result.getElementsByTagName('work')[0].childNodes[0].nodeValue;

                //4就绪 200请求成功
                if (request.readyState == 4 && request.status == 200){
                    document.getElementById('name').innerHTML = name;
                    document.getElementById('sex').innerHTML = sex;
                    document.getElementById('lesson').innerHTML = lesson;
                    document.getElementById('job').innerHTML = job;
                    document.getElementById('work').innerHTML = work;
                }
            }
            return false;
        }
    }
</script>
</html>